import React, { Component } from 'react'

export default class Child2 extends Component {
  state = {
    count: 0,
  }
  componentDidMount() {
    // !#3 渲染完毕，等价于 Vue 中的 mounted
    this.emitter.on('changeCount', (count) => {
      this.setState({ count: this.state.count + count })
    })
  }
  render() {
    return <div>Child2 {this.state.count}</div>
  }
}
